/*
	路由表
*/
package router

import (
	"data/view/base"
	"data/view/card"
	"data/view/game"
	"data/view/login"
	"data/view/register"
	"data/view/shake"
	"data/view/verify"

	"github.com/ant0ine/go-json-rest/rest"
)

var DefaultRouler = []*rest.Route{
	//管理员登录授权 相关
	Post("/login", login.M_login.OnLogin),              //用户登录
	Post("/check_token", login.M_login.CheckToken),     //验证token
	Post("/refresh_token", login.M_login.RefreshToken), //刷新token管理员
	Post("/go/verify", verify.M_verify.GetVerify),      //获取验证码
	Post("/go/doaction", register.M_register.DoAction), //注册或修改密码

	Post("/game/save", game.SaveGameInfo), //保存游玩信息
	Post("/game/get", game.GetGameInfo),   //获取游玩信息
	Post("/game/get_rank", game.GetRank),  //获取排名信息

	Post("/card/get_code", card.GetCode), //查询卡券
	Post("/card/comsume", card.Comsume),  //核销

	Post("/card/get_sign", card.GetSign), //获取卡券js签名信息
	Post("/base/get_sign", base.GetSign), //获取js签名信息

	Post("/shake/get", shake.GetShakeInfo), //获取用户摇一摇信息
	Post("/shake/add", shake.AddCount),     //增加摇一摇
	Post("/shake/action", shake.Action),    //摇一摇
}

/*
	默认初始化
*/
func OnInitRoter(api *rest.Api) (router rest.App, err error) {
	router, err = rest.MakeRouter(
		DefaultRouler...,
	)

	return
}
